package com.superb.common.nacos.service.impl;

import com.alibaba.nacos.api.naming.listener.Event;
import com.superb.common.nacos.service.SuperbNacosService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.text.MessageFormat;

/**
 * @Author: ajie
 * @CreateTime: 2024-05-15 15:20
 */
@Slf4j
@Service
public class SuperbNacosServiceImpl implements SuperbNacosService {

    @Override
    public void configChange(String dateId, String configInfo) {
        log.debug(MessageFormat.format("配置改变,dateId:{0},内容:{1}", dateId, configInfo));
    }

    @Override
    public void serviceChange(String serviceName, Event event) {
        log.debug(MessageFormat.format("服务变更,服务名:{0}", serviceName));
    }

    @Override
    public void serviceNodeChange(String serviceName, String host, int port, String event) {
        log.debug(MessageFormat.format("服务节点变更,服务名:{0},ip:{1},port:{2},动作:{3}", serviceName, host, "" + port, event));
    }

    @Override
    public void currentNodeState(String event) {
        log.debug(MessageFormat.format("当前服务节点变更,动作:{0}", event));
    }
}
